const path = require('path');

module.exports = {
	mode: 'development',
	// context 默认为项目根目录, 即path.resolve(__dirname, '../')
	context: path.resolve(__dirname, '../'), // 基础目录，绝对路径，用于从配置中解析入口起点(entry point)和 loader
	entry: './src/entrys/entry2.js',
	output: {
		filename: 'entry2.js',
		path: path.resolve(__dirname, '../dists/dist2'),
		publicPath: '../../dists/dist2/'	// 执行npm run server时用'/', 其他用'./'
	},
	module: {
		rules: [{
				test: /\.css$/,
				use: [
					'style-loader',
					'css-loader'
				]
			},
			{
				test: /\.(png|svg|jpg|gif)$/,
				use: [
					'file-loader'
				]
			},
			{
			  test: /\.(woff|woff2|eot|ttf|otf)$/,
			  use: [
				'file-loader'
			  ]
			},
			{
				test: /\.(csv|tsv)$/,
				use: [
				   'csv-loader'
				]
			},
			{
				test: /\.xml$/,
				use: [
				   'xml-loader'
				]
			}
		]
	}
}